feat: add PostgreSQL replication health auto rebuild - #40
Merged
wallyxjh merged 3 commits intoJun 24, 2026
Merged
Conversation
Check PostgreSQL leader and replica replication state with read-only SQL, report replication readiness on Component status, and create a guarded RebuildInstance OpsRequest after persistent replica failure. Also add the OpsRequest RBAC marker and focused replication health tests.
Treat streaming replicas on a different PostgreSQL timeline as rebuildable replication health failures. Also guard against rebuilding when the selected primary is still in recovery, and avoid retained WAL calculations while the selected leader is in recovery.
Reduce the default PostgreSQL replication health requeue interval from five minutes to ten minutes to lower controller queue and pods/exec background load while keeping periodic detection enabled.
wallyxjh
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A PostgreSQL replica can stay Kubernetes-ready while it has already fallen out of the primary replication chain. This can leave physical replication slots inactive on the primary and cause WAL to accumulate until the primary PVC fills up.
This PR lets KubeBlocks detect that state and rebuild only the affected replica after the failure remains stable for a configured window.